import { ApolloQueryResult, FetchResult, FetchPolicy } from '@apollo/client/core';
import { Observable } from 'rxjs';
/**************************************************************************************
 * 名称服务
 */
/*************************************************************************************
 * 服务接口定义
 */
export interface NamesServiceApi {
  lookup(variables: NamesService_lookupVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_lookupResult>>; // 查找资源
  dir(variables: NamesService_dirVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_dirResult>>; // 查询目录
  findAllFiles(variables: NamesService_findAllFilesVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_findAllFilesResult>>; // 获取目录下所有文件
  findFiles(variables: NamesService_findFilesVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_findFilesResult>>; // 获取文件
  list(variables: NamesService_listVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_listResult>>; // 分页查询
  totalCount(): Observable<ApolloQueryResult<NamesService_totalCountResult>>; // 统计库中所有对象的数据量
  search(variables: NamesService_searchVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_searchResult>>; // 游标查询
  loadAll(): Observable<ApolloQueryResult<NamesService_loadAllResult>>; // 获取库中所有数据，数据量大时请谨慎使用
  getById(variables: NamesService_getByIdVariables, options:NamesServiceQueryOptions): Observable<ApolloQueryResult<NamesService_getByIdResult>>; // 获取一个对象
  mkdir(variables: NamesService_mkdirVariables): Observable<FetchResult<NamesService_mkdirResult>>; // 创建目录
  moveToRecycleBin(variables: NamesService_moveToRecycleBinVariables): Observable<FetchResult<NamesService_moveToRecycleBinResult>>; // 移至回收站
  removePath(variables: NamesService_removePathVariables): Observable<FetchResult<NamesService_removePathResult>>; // 彻底删除资源
  save(variables: NamesService_saveVariables): Observable<FetchResult<NamesService_saveResult>>; // 保存对象
  removeById(variables: NamesService_removeByIdVariables): Observable<FetchResult<NamesService_removeByIdResult>>; // 删除一个对象
  removeByIdList(variables: NamesService_removeByIdListVariables): Observable<FetchResult<NamesService_removeByIdListResult>>; // 删除一批对象
}
export interface NamesServiceQueryOptions{
  cachePolicy:FetchPolicy;
  more:boolean;
}

/**
 * 查找资源
 */
export interface NamesService_lookupResult{
    namesService_lookup: MelonNamesPackage;
}
export interface NamesService_lookupVariables{
      path: string; // 资源路径
}

/**
 * 查询目录
 */
export interface NamesService_dirResult{
    namesService_dir: MelonNamesConnection;
}
export interface NamesService_dirVariables{
      path: string; // 目录路径
      first: number; // 获取数量
      offset: number; // 获取偏移
      filter: MelonNamesFilter; // 过滤条件
      orderBy?: MelonNamesOrderBy; // 排序
}

/**
 * 获取目录下所有文件
 */
export interface NamesService_findAllFilesResult{
    namesService_findAllFiles: MelonNamesConnection;
}
export interface NamesService_findAllFilesVariables{
      path: string; // 路径
}

/**
 * 获取文件
 */
export interface NamesService_findFilesResult{
    namesService_findFiles: MelonNamesConnection;
}
export interface NamesService_findFilesVariables{
      path: string; // 路径
      first: number; // 数量
      offset: number; // 偏移
}

/**
 * 分页查询
 */
export interface NamesService_listResult{
    namesService_list: MelonNamesConnection;
}
export interface NamesService_listVariables{
      filter: MelonNamesFilter; // 过滤条件
      orderBy?: MelonNamesOrderBy; // 排序方式
}

/**
 * 统计库中所有对象的数据量
 */
export interface NamesService_totalCountResult{
    namesService_totalCount: number;
}

/**
 * 游标查询
 */
export interface NamesService_searchResult{
    namesService_search: MelonNamesConnection;
}
export interface NamesService_searchVariables{
      first: number; // 获取数据量
      offset: number; // 获取数据起始位置
      filter: MelonNamesFilter; // 过滤条件
      orderBy?: MelonNamesOrderBy; // 排序方式
}

/**
 * 获取库中所有数据，数据量大时请谨慎使用
 */
export interface NamesService_loadAllResult{
    namesService_loadAll: MelonNamesConnection;
}

/**
 * 获取一个对象
 */
export interface NamesService_getByIdResult{
    namesService_getById: MelonNamesPackage;
}
export interface NamesService_getByIdVariables{
      id: string; // 对象的ID值
}


export interface NamesService_mkdirResult{
  namesService_mkdir: MelonNamesMutationInfo;
}

/**
 * 创建目录
 */
export interface NamesService_mkdirVariables{
    path: string; // 目录路径
}

export interface NamesService_moveToRecycleBinResult{
  namesService_moveToRecycleBin: MelonNamesMutationInfo;
}

/**
 * 移至回收站
 */
export interface NamesService_moveToRecycleBinVariables{
    path: string[]; // 资源路径
}

export interface NamesService_removePathResult{
  namesService_removePath: MelonNamesMutationInfo;
}

/**
 * 彻底删除资源
 */
export interface NamesService_removePathVariables{
    paths: string[]; // 路径
}

export interface NamesService_saveResult{
  namesService_save: MelonNamesMutationInfo;
}

/**
 * 保存对象
 */
export interface NamesService_saveVariables{
    entity: MelonNamesInput; // 保存对象，无id值新增，有id值修改，如果修改未找到对象则抛出异常修改失败
}

export interface NamesService_removeByIdResult{
  namesService_removeById: MelonNamesMutationInfo;
}

/**
 * 删除一个对象
 */
export interface NamesService_removeByIdVariables{
    id: string; // 对象ID值
}

export interface NamesService_removeByIdListResult{
  namesService_removeByIdList: MelonNamesMutationInfo;
}

/**
 * 删除一批对象
 */
export interface NamesService_removeByIdListVariables{
    ids: string[]; // 对象ID值列表
}
/**
 * 错误信息
 */
export interface MelonNamesErrorBody {
  message: string;
  stackTrace: string;
}

/**
 * 查询结果信息
 */
export interface MelonNamesResultInfo {
  totalCount: number;
  queryTime: number;
  sign: string;
  message: string;
}

/**
 * 分页信息
 */
export interface MelonNamesPageInfo{
  page: number;
  size: number;
  offset: number;
  endCursor: string;
  hasNextPage: boolean;
}

/**
 * 查询集合返回对象
 */
export interface  MelonNamesConnection{
  resultInfo: MelonNamesResultInfo;
  edges: MelonNamesVoViewEdge[];
  pageInfo: MelonNamesPageInfo;
  uuid: string;
}
export interface MelonNamesVoViewEdge{
  node:MelonNamesVoView;
}
/**
 * 查询单个对象返回结果
 */
export interface MelonNamesPackage{
  resultInfo: MelonNamesResultInfo;
  entity: MelonNamesVoView;
  uuid: string;
}

/**
 * 排序类型
 */
export interface MelonNamesOrderBy {
  field: string;
  type: 'ASC' | 'DESC';
}

/**
 * 更新返回结果信息
 */
export interface MelonNamesMutationInfo {
  status: boolean;
  rows: number;
  messages: string;
  uuid: string;
  sign: string;
  executeTime: number;
  result: MelonNamesVoView;
}

/**
 * 字符串筛选接口
 */
export interface MelonNamesStringFilter {
  eq?: string;
  neq?: string;
  like?: string;
  in?: string[];
  nin?: string[];
  gt?: string;
  lt?: string;
  gte?: string;
  lte?: string;
}

/**
 * 数字过滤条件接口
 */
export interface MelonNamesNumberFilter {
  eq?: number;
  neq?: number;
  in?: number[];
  nin?: number[];
  gt?: number;
  lt?: number;
  gte?: number;
  lte?: number;
}

/**
 * 布尔类型删选接口
 */
export interface MelonNamesBooleanFilter {
  eq?: boolean;
  neq?: boolean;
}




/*****************************************************************************************
 * 查询接口
 */
export const namesServiceQuery = {
   // 查找资源
  namesService_lookup: `namesService_lookup(path:$path){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    entity{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    uuid
  }`
, // 查询目录
  namesService_dir: `namesService_dir(path:$path,first:$first,offset:$offset,filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取目录下所有文件
  namesService_findAllFiles: `namesService_findAllFiles(path:$path){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取文件
  namesService_findFiles: `namesService_findFiles(path:$path,first:$first,offset:$offset){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 分页查询
  namesService_list: `namesService_list(filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 统计库中所有对象的数据量
  namesService_totalCount: `namesService_totalCount`
, // 游标查询
  namesService_search: `namesService_search(first:$first,offset:$offset,filter:$filter,orderBy:$orderBy){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取库中所有数据，数据量大时请谨慎使用
  namesService_loadAll: `namesService_loadAll{
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    edges{
      node{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
        }
    }
    pageInfo{
      page
      size
      offset
      hasNextPage
      endCursor
    }
    uuid
  }`
, // 获取一个对象
  namesService_getById: `namesService_getById(id:$id){
    resultInfo{
      totalCount
      queryTime
      sign
      message
    }
    entity{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    uuid
  }`
};

/*********************************************************************
 * 更新接口信息
 */
export const namesServiceMutation = {
   // 创建目录
  namesService_mkdir: `namesService_mkdir(path:$path){
    status
    rows
    messages
    uuid
    sign
    executeTime
    result{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    errorBody{
      message
      stackTrace
    }
  }`
, // 移至回收站
  namesService_moveToRecycleBin: `namesService_moveToRecycleBin(path:$path){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 彻底删除资源
  namesService_removePath: `namesService_removePath(paths:$paths){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 保存对象
  namesService_save: `namesService_save(entity:$entity){
    status
    rows
    messages
    uuid
    sign
    executeTime
    result{
      name
      path
      namesType
      ext
        {
      extName
      contentType
      size
        }
      tenantId
      tenant
      tenantCode
      tenantName
      creator
      creatorId
      creatorCode
      creatorName
      createDateTime
      lastModifiedDateTime
      sortNum
      id
    }
    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一个对象
  namesService_removeById: `namesService_removeById(id:$id){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
, // 删除一批对象
  namesService_removeByIdList: `namesService_removeByIdList(ids:$ids){
    status
    rows
    messages
    uuid
    sign
    executeTime

    errorBody{
      message
      stackTrace
    }
  }`
};

/************************************************************************
 * 类型信息
 */
/**
 * 未提供
 */
export interface MelonNamesStore {
  name: string; // 名称
  path?: string; // 路径
  parent_id?: string; // 父目录
  namesType?: 'DIRECTORY' | 'FILE' | 'LINK' | 'OUT_LINK' | 'ALI_YUN' | 'TX_YUN' | 'OTHER'; // 名称类型
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人名称
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: string; // 未说明
  [props: string]: any;
}
/**
 * 未提供
 */
export interface MelonNamesVoView {
  name: string; // 名称
  path?: string; // 路径
  namesType?: 'DIRECTORY' | 'FILE' | 'LINK' | 'OUT_LINK' | 'ALI_YUN' | 'TX_YUN' | 'OTHER'; // 名称类型
  ext?: MelonNamesExtVo; // 扩展信息
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人名称
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: string; // 未说明
  [props: string]: any;
}
/**
 * 未提供
 */
export interface MelonNamesInput {
  name: string; // 名称
  path?: string; // 路径
  parent_id?: string; // 父目录
  namesType?: 'DIRECTORY' | 'FILE' | 'LINK' | 'OUT_LINK' | 'ALI_YUN' | 'TX_YUN' | 'OTHER'; // 名称类型
  tenantId?: string; // 租户ID
  tenant?: string; // 租户快照信息
  tenantCode?: string; // 租户编号
  tenantName?: string; // 租户名称
  creator?: string; // 创建人快照信息
  creatorId?: string; // 创建人ID
  creatorCode?: string; // 创建人账号
  creatorName?: string; // 创建人名称
  createDateTime?: number; // 创建时间
  lastModifiedDateTime?: number; // 最后修改时间
  sortNum?: number; // 默认排序字段
  id?: string; // 未说明
  [props: string]: any;
}
/**
 * 未提供
 */
export interface MelonNamesFilter {
  name?: MelonNamesStringFilter; // 名称
  path?: MelonNamesStringFilter; // 路径
  parent_id?: MelonNamesStringFilter; // 父目录
  namesType?: MelonNamesStringFilter; // 名称类型
  tenantId?: MelonNamesStringFilter; // 租户ID
  tenant?: MelonNamesStringFilter; // 租户快照信息
  tenantCode?: MelonNamesStringFilter; // 租户编号
  tenantName?: MelonNamesStringFilter; // 租户名称
  creator?: MelonNamesStringFilter; // 创建人快照信息
  creatorId?: MelonNamesStringFilter; // 创建人ID
  creatorCode?: MelonNamesStringFilter; // 创建人账号
  creatorName?: MelonNamesStringFilter; // 创建人名称
  createDateTime?: MelonNamesNumberFilter; // 创建时间
  lastModifiedDateTime?: MelonNamesNumberFilter; // 最后修改时间
  sortNum?: MelonNamesNumberFilter; // 默认排序字段
  id?: MelonNamesStringFilter; // 未说明
  [props: string]: any;
}
/**
 * 扩展信息
 */
export interface MelonNamesExtVo {
  extName?: string; // 扩展名
  contentType?: string; // 解析方式
  size?: number; // 资源大小
  [props: string]: any;
}
